package com.example.project.controller;

import com.example.project.entity.Record;
import com.example.project.service.IRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
/*
编写者：王住泽
 */
@RestController
@Api
public class RecordController {
    @Autowired
    private IRecordService recordServic;

    @RequestMapping("/Record")
    public String Record() {
        return "档案信息管理系统";
    }

    @ApiOperation(value = "添加档案信息")
    @RequestMapping("addRecord")
    public int insertRecord(Record record) {
        return recordServic.insertRecord(record);
    }

    @ApiOperation(value = "删除档案信息")
    @RequestMapping("/deletRecorde")
    public int delectRecord(int Id) {
        Record record = new Record();
        record.setId(Id);
        return recordServic.deleteRecord(record);
    }

    @ApiOperation(value = "修改档案信息",
            notes = "成功返回1")
    @RequestMapping("/updateRecord")
    public int updateRecord(Record record) {
        return recordServic.updateRecord(record);
    }

    @ApiOperation(value = "查询所有档案信息",
            notes = "成功返回1")
    @RequestMapping("/getAllRecord")
    public List<Record> getAllRecord(Record record) {
        return recordServic.getAllRecord(record);
    }

    @ApiOperation(value = "查询档案信息",
            notes = "成功返回1")
    @RequestMapping("/getRecord")
    public Record getId(int Id) {
        Record record = new Record();
        record.setId(Id);
        return recordServic.getRecord(record);
    }
}
